﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfApp4.Models.Caches
{
    public class CommonCache : Singleton<CommonCache>
    {
        private Hashtable hashtable = new Hashtable();

        public void Set(string key, object value)
        {
            hashtable[key] = value;
        }

        public object Get(string key)
        {
            if (!hashtable.ContainsKey(key)) return null;
            return hashtable[key];
        }

        public object Pop(string key)
        {
            if (!hashtable.ContainsKey(key)) return null;
            var data = hashtable[key];
            hashtable.Remove(key);
            return data;
        }
    }
}
